﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Microsoft.Win32;
using System.IO;

namespace TfsBacklogMgr.Main
{
    /// <summary>
    /// Interaction logic for UserDetails.xaml
    /// </summary>
    public partial class UserDetails : Window
    {

        public UserDetails(Context ctx)
        {
            InitializeComponent();
            DataContext = ctx;
        }

        private void Picture_Clicked(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();
            dlg.Title = "Choose image for " + Context.GetContext().CurrentUser.Name;
            dlg.InitialDirectory = Directory.GetCurrentDirectory();
            dlg.AddExtension = true;
            dlg.DefaultExt = ".jpg";
            dlg.Filter = "Image Files(*.bmp;*.jpg;*.jpeg;*.png;*.gif)|*.bmp;*.jpg;*.jpeg;*.png;*.gif|All files (*.*)|*.*";
            if(dlg.ShowDialog() == true)
            {
                Context.GetContext().CurrentUser.ImagePath = dlg.FileName;
            }
        }
    }
}
